<template>
	<uni-data-picker
		ref="dataPickerRef"
		:placeholder="data.placeholder"
		:popup-title="data.placeholder"
		:border="false"
		v-model="props.modelValue"
		:localdata="props.data.options"
		:clear-icon="props.data.clearIcon"
		@change="onchange"
		@nodeclick="onnodeclick"
		@popupopened="onpopupopened"
		@popupclosed="onpopupclosed"
	></uni-data-picker>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const props = defineProps({
	//表单组件参数
	data: {
		type: Object,
		required: true
	},
	modelValue: {}
})

const emit = defineEmits(['update:modelValue', 'valueChange'])
const dataPickerRef = ref()
const onchange = (e: any) => {
	const value = e.detail.value
	let returnValue = []
	value.map((item: any) => returnValue.push(item.value))
	emit('update:modelValue', returnValue)
	emit('valueChange', returnValue)
}

const onnodeclick = node => {}
const onpopupopened = e => {}
const onpopupclosed = e => {}
</script>
